#include "speed_debuff.h"


CSpeedDebuff::CSpeedDebuff()
    : CBuff(ENT_DEBUFF_SPEED, "speeddebuff", BUFF_TYPE_DEBUFF)
{
}

bool CSpeedDebuff::applyBuff(CPlayer *pPlayer)
{
    /**
     * Applies the speed debuff to a player. We just want to decrement the
     * player's speed.
     *
     * @param CPlayer *pPlayer A pointer to the player to apply the debuff to.
     */
    if (pPlayer->getSpeed() > 0.8)
    {
        pPlayer->setSpeed(pPlayer->getSpeed() - Constants::BUFF_SPEED_INCREASE);
        return true;
    }
    return false;
}

bool CSpeedDebuff::removeBuff(CPlayer *pPlayer)
{
    /**
     * Removes the speed debuff to a player. We just want to increment the
     * player's speed.
     *
     * @param CPlayer *pPlayer A pointer to the player to apply the debuff to.
     */
    pPlayer->setSpeed(pPlayer->getSpeed() + Constants::BUFF_SPEED_INCREASE);
    return true;
}